import { BTState } from "../BTState";
import { BTDecorator } from "./BTDecorator";

/**
 * [行为树]直到成功节点
 * 子节点返回成功时 -> 返回成功
 * 否则 -> 返回run
 */
export class BTUntilSucc<T = any> extends BTDecorator<T>{

    process(ctx: T): BTState {
        if (this.child.tick(ctx) === BTState.succ) {
            return BTState.succ;
        }
        return BTState.run;
    }

}